﻿using System;

namespace Matrix
{
    class Program
    {
        static bool is_toeplitz(int[,] matrix)
        {
            int row = matrix.GetLength(0);
            int col = matrix.GetLength(1);
            for (int i = 0; i < row - 1; i++)
            {
                for (int j = 0; j < col - 1; j++)
                {
                    if (matrix[i, j] != matrix[i + 1, j + 1])
                    {
                        return false;
                    }
                }
            }
            return true;
        }
        static void Main()
        {
            Console.WriteLine("请输入矩阵的行数和列数，用空格分割");
            string str = Console.ReadLine();
            string[] input = str.Split(" ");
            int row = int.Parse(input[0]);
            int col = int.Parse(input[1]);
            int[,] matrix = new int[row, col];
            Console.WriteLine("请输入矩阵的元素，用空格分割");
            for (int i = 0; i < row; i++)
            {
                string str1 = Console.ReadLine();
                string[] input1 = str1.Split(" ");
                for (int j = 0; j < col; j++)
                {
                    matrix[i, j] = int.Parse(input1[j]);
                }
            }
            Console.WriteLine("矩阵");
            if(is_toeplitz(matrix))
            {
                Console.WriteLine("是");
            }
            else
            {
                Console.WriteLine("不是");
            }
            Console.WriteLine("托普利茨矩阵");
        }
    }
}